home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 14
/
Hot Mix 14.iso
/
HTML
/
vendors
/
finesse
/
examples
/
sh
/
xtar
< prev
Wrap
Text File
|
1996-06-27
|
3KB
|
150 lines
#! /bin/sh
# FINESSEAPPLICATIONKEY sIjfovexnmgN?
#
. ${FINESSEPATH-/usr/local/finesse}/fsshinit
#
create=create
extract=extract
list=list
copy=copy
Floppy=Floppy
Exabyte=Exabyte
QIC=QIC
DAT=DAT
DV=File/Directory
DVe=File/Directories
windef="
FsWindow -name tarwin
-title xtar
-btype oxa;
FsSeparator;
FsForm -name form1;
FsRadio -label Action:
-items '$create $extract $list $copy'
-parent form1 -var key==$extract;
FsList -label $DVe:
-items '`ls`'
-nvisible 10
-include yes
-mode multiple
-var filelist=='`ls`';
FsSeparator -name sep1
-line dashed;
FsForm -name form2
-orientation horizontal;
FsRadio -label Archive:
-nrows 5
-parent form2
-var archive
-items '$Floppy $DV $Exabyte $QIC $DAT';
FsForm -name form3 -parent form2;
FsSeparator -line no -name sep2 -parent form3;
FsText -var tarfile -parent form3;
FsSeparator -line soliddouble;"
Fsopen "$@"
Fsdisplay -w "$windef" -m " "
if [ "$fsbutton" != "o" ] ; then
Fsclose; exit
fi
# Certain conditions must be met:
# 1) list of files must be given
testfilelist()
{
if [ -z "$filelist" ] ; then
mesg="Please specify $DVe ..."
return 1 # Error
else
return 0 # OK
fi
}
# 2) For "Copy" or "File/Directory",
# tar file must be given
testtarfile()
{
if [ "$key" = "$copy" -o "$archive" = "$DV" ] ; then
if [ -z "$tarfile" ] ; then
mesg="Please specify $DV ..."
return 1; # Error
else
return 0; # OK
fi
else
return 0; # don't mind
fi
}
# test conditions
until testfilelist &&
testtarfile
do
Fsdisplay -n tarwin -m "$mesg"
if [ "$fsbutton" != "o" ] ; then
Fsclose; exit
fi
done
# Device file for archive
case $archive in
$Floppy) dev="f /dev/floppy";;
$Exabyte) dev="f /dev/exa";;
$DAT) dev="f /dev/dat";;
$QIC) dev="f /dev/qic";;
$DV) case $key in
$copy) dev="$tarfile";;
*) dev="f $tarfile";;
esac;;
esac
# Now the command may be put together
case $key in
$create) com="tar cv$dev $filelist";;
$extract) com="tar xv$dev $filelist";;
$list) com="tar t$dev $filelist";;
$copy) com="tar cf - $filelist | (cd $dev; tar xf -)";;
esac
# final hint
case $key in
$create|$extract|$list)
Fsdisplay -w "FsWindow -btype oa;" -m "Medium inserted?"
if [ "$fsbutton" != "o" ] ; then
Fsclose; exit
fi;;
esac
# just pretend to do
#
Fsecho "Command:"
Fsecho $com
Fsecho started.
sleep 5
Fsclose